package com.example.mvp.model;

import java.io.Serializable;

/**
 * Created by xzh on 2018/3/3.
 * 邮箱 ：347649749@qq.com
 * 版本 ： ver 1.0
 */

public class UserBean {

    private long id;
    private String userName;
    private String nickName;
    private String password;

    public UserBean() {
    }

    public UserBean(long id,String userName, String nickName, String password) {
        this.id = id;
        this.userName = userName;
        this.nickName = nickName;
        this.password = password;
    }

    public UserBean(String userName, String nickName, String password) {
        this.userName = userName;
        this.nickName = nickName;
        this.password = password;
    }
    public UserBean(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    //检查model 的有效性
    public int checkUserValidity(String str1,String str2){
        if (str1 == null || str2 == null || str1.isEmpty() || str2.isEmpty()){
            //账号密码为空判断
            return -2;
        }else{
            if (str1.equals(userName) && str2.equals(password)){
                //用户名是否正确
                return 1;
            }else {
                return -1;
            }
        }
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", nickName='" + nickName + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
